package com.jfinal.plugin.radius;

import java.io.IOException;
import com.jfinal.plugin.radius.util.RadiusClient;
import com.jfinal.plugin.radius.util.RadiusException;

/**
 * Radius.
 * Radius 工具类
 * <pre>
 * 例如：
 * Radius.auth("user", "pass");
 * </pre>
 */
public class Radius {
	
	public static RadiusClient mainClient = null;
	
	public static boolean auth(String userName,String pwd) {
		boolean result = false;
		try {
			result = mainClient.authenticate(userName, pwd);
		} catch (IOException e) {
			throw new IllegalArgumentException(e.getMessage());
		} catch (RadiusException e) {
			throw new IllegalArgumentException(e.getMessage());
		}
		return result;
	}

}